#ifndef RTSPGRAB_H
#define RTSPGRAB_H

#include <QObject>
#include <QImage>

extern "C"{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>
}

class RtspGrab : public QObject
{
    Q_OBJECT
public:
    explicit RtspGrab(QObject *parent = nullptr);
    virtual ~RtspGrab();
    int init();


signals:
    void sig_GetOneFrame(QImage img);

public slots:
    int readFrame();
    int readFrames();
private:


private:
    AVFormatContext *m_AVFormatContext;
    int m_videoIndex;
    AVCodecContext *m_AVCodecContext;
    AVCodec *m_AVCodec;
    AVFrame *m_AVFrame;
    AVFrame *m_AVFrameRGB;
    SwsContext *m_SwsContext;
    uint8_t *m_OutBuffer;
    AVPacket *m_AVPacket;
};

#endif // RTSPGRAB_H
